package app

import (
	"blog/app/common"
	"blog/app/router"
	"github.com/kataras/iris"
	"blog/app/middlewares"
)

func Run() {
	app := iris.New()

	// 允许跨域
	app.Use(middlewares.Crs())
	app.Options("/*", func(ctx iris.Context) {
		ctx.Text("welcome to lhlyu blog")
		return
	})

	app.PartyFunc("/", router.SetRouter)
	app.Run(iris.Addr(common.C.Port))
}
